package day04;

import java.util.Scanner;

public class Guessing {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = (int) (Math.random() * 1000 + 1);//设定一个要猜的数
        System.out.println(num);
        int guess;
        do {
            System.out.println("来猜吧");
            guess = scan.nextInt();
            if (guess>num) {
                System.out.println("猜大了");
            } else if (guess<num) {
                System.out.println("猜小了");
            }else {
                System.out.println("恭喜你猜对了");
            }

        }while (guess!=num);








        /*int guess=scan.nextInt();//输出你要猜的数
        while (guess!=num){//判断猜的数是否是250
            if (guess>num) {//判断猜的数是否大了
                System.out.println("猜大了");
            }else  {//判断猜的数是否小了

                System.out.println("猜小了");
            }

            System.out.println("重新猜");
            guess=scan.nextInt();
        }
        System.out.println("恭喜你,猜对了");
    }

         */
    }
}
